Skip to content

fix(transport): reject malformed D-Bus signatures - #7

Draft
pjeweb wants to merge 2 commits into
osb/pr/fuzz-property-testsfrom
osb/pr/dbus-signature-validation
Draft

pjeweb wants to merge 2 commits into
osb/pr/fuzz-property-testsfrom
osb/pr/dbus-signature-validation

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 22, 2026 •

Copy link
Copy Markdown

parseSignature accepted signatures the wire format does not allow: a stray ) or }, (), a dict entry with one or three members or outside an array, the binding-only r and e, and any nesting depth. A signature with a couple of hundred thousand a characters overflowed the stack instead of failing cleanly. The signature of a decoded reply comes from the bus, so it should not be trusted.

  • Rejects the malformed shapes above with an Error.
  • Enforces the D-Bus limits: 255 bytes, and 32 nested arrays, 32 nested structs and 32 nested dict entries, each counted separately as libdbus does.
  • Adds signature.test.ts (accepted and rejected signatures, including a 200,000-deep one) and the matching fast-check property.

The new tests fail on main. Sits on the property test PR.

parseSignature accepted a stray ) or }, empty structs, dict entries with the wrong member count or outside an array, the binding-only r and e, and any nesting depth or length, so a hostile or corrupt signature could overflow the stack. It now enforces the specification's structure and its limits of 32 nested arrays, 32 nested structs and 255 bytes.
@pjeweb pjeweb added upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. stacked Depends on another pull request; review and integrate parents first. labels Nov 22, 2026
…re depth

A dict entry inside a deeply nested struct was rejected because both shared one depth counter. Structs and dict entries now each have their own limit of 32, as in libdbus.
@pjeweb pjeweb added the parked Parked or held for now; not planned for a train until picked up again. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parked Parked or held for now; not planned for a train until picked up again. stacked Depends on another pull request; review and integrate parents first. upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant